#version 460
#extension GL_GOOGLE_include_directive : enable

#include "../../../core/shader_color.h"
#include "../../../core/shader_tranform.h"
#include "../../../core/shader_widget_color.h"
#include "../../../core/shader_widget_panel.h"



layout(location = 0) out vec4		gColor;
layout(location = 1) out flat float	gUvCoord;
layout(location = 2) out flat mat2	gRot;

out gl_PerVertex {
	vec4	gl_Position;
	float	gl_PointSize;
};



//vec2 pos[4] = {vec2(10.0, 10.0), vec2(100.0, 10.0), vec2(10.0, 100.0), vec2(100.0, 100.0)};
void main(void){
	mat3x2 mat = m_LP_SD[gl_InstanceIndex];
	gUvCoord = mat[2].x;

	gRot[0] = vec2(cos(mat[2].y), -sin(mat[2].y));
	gRot[1] = vec2(sin(mat[2].y), cos(mat[2].y));

	gl_PointSize = mat[1].x * m_Scale.x;
	
	gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
	gl_Position.xy = mat[0];
	gl_Position.xy *= m_Scale;
	gl_Position.xy += m_Loc;

	gl_Position = mat_ProjecView * gl_Position;

	gColor = f_glsl_buildColor(InstanceColor[gl_InstanceIndex]);
	
}



